<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <!-- 1.下载 -->

    <!-- 2.引入 -->
    <link rel="stylesheet" href="./node_modules/animate.css/animate.css">
    <style>
        .box {
            width: 100px;
            height: 100px;
            background: green;
            position: absolute;
            left: 500px;
            top: 100px;
        }
    </style>
</head>

<body>
    <!-- 定义挂载点 -->
    <div id="app">
        <button @click=" isShow = !isShow ">开关</button>
        <!-- 1.给谁加动画，就用transition标签嵌套他 
             2. enter-active-class='进入的样式'
             3. leave-active-class='离开的样式'
            不会同时使用进入和离开的状态，一般都是使用进入的状态
        -->
        <transition
            enter-active-class="animate__animated animate__fadeInLeft"
            leave-active-class="animate__animated animate__fadeOutRight"
        >
            <div class="box" v-if="isShow"></div>
        </transition>
    </div>
    <script>
        new Vue({
            //挂载点
            el: "#app",
            //数据
            data: {
                isShow: false
            },
            //方法
            methods: {}
        })
    </script>
</body>

</html>